from threading import Thread, active_count, current_thread
import time


def task():
    print('hello world', current_thread().name)
    time.sleep(1)


if __name__ == '__main__':
    t = Thread(target=task)
    t1 = Thread(target=task)
    t.start()
    t1.start()
    print('主', current_thread().name, active_count())  # 获取线程个数
